<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	layout:decorator="layout">
<head>
<title th:text="${model!=null && model.id!=null}? '修改游戏' : '新增游戏'">新增游戏</title>
</head>
<body>
	<div layout:fragment="content">
		<div class="row">
			<label th:text="${model!=null && model.id!=null}? '修改游戏' : '新增游戏'">新增游戏</label>
		</div>
		<form class="form-horizontal" 
				th:action="${id} ? @{/game(update)} : @{/game(add)}" 
				th:object="${model}" method="post">
				
			<input type="hidden" name="id" th:value="${id}">
			
			<div class="form-group" th:class="${#fields.hasErrors('name')} ? 'form-group has-error' :'form-group'" >
				<label class="col-sm-2 control-label">游戏名称</label>
				<div class="col-sm-5 ">
					<input type="text" name="name" th:field="*{name}" class="form-control">
				</div>
				<label class="col-sm-2 control-label"  th:errors="*{name}"></label>
			</div>
			
			<div class="form-group" th:class="${#fields.hasErrors('gamePlat')} ? 'form-group has-error' :'form-group'" >
				<label class="col-sm-2 control-label">平台</label>
				<div class="col-sm-5">
					<label class="radio-inline"> 
						<input type="radio" th:field="*{gamePlat}" th:checked="${#strings.equals(gamePlat, 1)}" value="1"> 端游
					</label> 
					<label class="checkbox-inline"> 
						<input type="radio" th:field="*{gamePlat}" th:checked="${#strings.equals(gamePlat, 2)}" value="2"> 页游
					</label> <label class="checkbox-inline"> 
						<input type="radio" th:field="*{gamePlat}" th:checked="${#strings.equals(gamePlat, 3)}" value="3"> 手游
					</label>
				</div>
				<label class="col-sm-2 control-label" th:errors="*{gamePlat}"></label>
			</div>
			
			<div class="form-group" th:class="${#fields.hasErrors('gameType')} ? 'form-group has-error' :'form-group'">
				<label  class="col-sm-2 control-label">类型</label>
				<div class="col-sm-5">
					<select class="form-control" th:field="*{gameType}">
						<option value="1"  th:selected="${gameType==1}">休闲益智</option>
						<option value="2"  th:selected="${gameType==2}">卡牌</option>
						<option value="3"  th:selected="${gameType==3}">格斗</option>
					</select>
				</div>
				<label class="col-sm-2 control-label" th:errors="*{gameType}"></label>
			</div>
			
			<div class="form-group" th:class="${#fields.hasErrors('logoUrl')} ? 'form-group has-error' :'form-group'">
				<label class="col-sm-2 control-label">封面图片</label>
				<div class="col-sm-5">
					<input type="text" th:field="*{logoUrl}"  class="form-control"
						placeholder="图片url">
				</div>
				<label class="col-sm-2 control-label" th:errors="*{logoUrl}"></label>
			</div>
			
			<div class="form-group" th:class="${#fields.hasErrors('installPkgUrl')} ? 'form-group has-error' :'form-group'">
				<label class="col-sm-2 control-label">下载地址</label>
				<div class="col-sm-5">
					<input type="text" th:field="*{installPkgUrl}"  class="form-control" placeholder="下载地址">
				</div>
				<label class="col-sm-2 control-label" th:errors="*{installPkgUrl}"></label>
			</div>
			
			<!-- <div class="form-group">
				<label  for="inputPassword3" class="col-sm-2 control-label">游戏简介</label>
				<div class="col-sm-5">
					<textarea class="form-control" rows="5"></textarea>
				</div>
			</div> -->

			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-default">保 存</button>
				</div>
			</div>
			
		</form>
	</div>
</body>
</html>
